﻿#pragma once
#include <stdio.h>
#include<Windows.h>
#include <stdbool.h>
//蛇的方向
typedef enum direction
{
	UP = 1,
	DOWN,
	LEFT,
	RIGHT
}DIRECTION;
//蛇的状态：1、正常 2、撞墙 3、撞自己 4、游戏退出
typedef enum
{
	OK,
	KILL_BY_WALL,
	KILL_BY_SELF,
	END_NOEMAL
}GAME_STATUS;

typedef struct snake_node
{
	int _x;
	int _y;

	struct snake_node* next;
}SnakeNode, *pSnakeNode;

typedef struct 
{
	pSnakeNode _pSnake;
	pSnakeNode _pFood;
	DIRECTION _dir;
	GAME_STATUS _status;
	int _food_weight;
	int _score;
	int _sleep_time;//休息时间，时间越短速度越快，时间越长速度越慢
}Snake,*pSnake;


void SetConsoleWindow(const wchar_t* title, int cols, int lines);
void HiddenCursor();
void WelcomeToGame();
void GameInit(pSnake psnake);
void GameRun();